﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="Referent_Unpaid.aspx.cs" Inherits="UdrinkWater_Project.Admin.Referent_Unpaid" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" 
        HeaderText="รายละเอียดการค้างชำระ" Width="100%">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
    <dx:ASPxGridView ID="GV_Sender" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlData_Sender" KeyFieldName="Order_Date" Width="100%">
        <Columns>
            <dx:GridViewCommandColumn Caption="ค้นหา" ShowInCustomizationForm="True" 
                VisibleIndex="0" Width="30px">
                <ClearFilterButton Visible="True">
                </ClearFilterButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataDateColumn Caption="เลขที่ใบรายการ" FieldName="Order_Date" 
                ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1" Width="180px">
                <PropertiesDateEdit DisplayFormatString="yyyy-MM-dd HH:mm:ss.fff" 
                    EditFormat="Custom">
                </PropertiesDateEdit>
                <Settings AllowAutoFilter="False" />
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn Caption="ชื่อลูกค้า" FieldName="Customer_ID" 
                ShowInCustomizationForm="True" VisibleIndex="2" Width="150px">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataDateColumn Caption="วันกำหนดส่ง" FieldName="Shipped_date" 
                ShowInCustomizationForm="True" VisibleIndex="3" Width="100px">
                <PropertiesDateEdit DisplayFormatString="dd MMMM yyyy">
                </PropertiesDateEdit>
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataTextColumn Caption="ที่อยู่การจัดส่ง" 
                FieldName="Delivery_Address" ShowInCustomizationForm="True" VisibleIndex="4">
                <Settings AllowAutoFilter="False" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataCheckColumn Caption="สถานะการจัดส่ง" FieldName="Status" 
                ShowInCustomizationForm="True" Visible="False" VisibleIndex="5" Width="50px">
                <PropertiesCheckEdit DisplayTextChecked="จัดส่งเรียบร้อยแล้ว" 
                    DisplayTextUnchecked="รอการจัดส่ง" ValueChecked="2" ValueType="System.Int32" 
                    ValueUnchecked="1">
                </PropertiesCheckEdit>
            </dx:GridViewDataCheckColumn>
            <dx:GridViewDataTextColumn Caption="พนักงานจัดส่ง" FieldName="Employee_ID" 
                ShowInCustomizationForm="True" Visible="False" VisibleIndex="6">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn Caption="สถานะการชำระเงิน" 
                FieldName="Status_Unpaid" ShowInCustomizationForm="True" Visible="False" 
                VisibleIndex="7" Width="80px">
                <PropertiesComboBox DataSourceID="SqlData_Unpaid" TextField="Unpaid_Name" 
                    ValueField="Unpaid_ID" ValueType="System.Int32">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataTextColumn ShowInCustomizationForm="True" VisibleIndex="8" 
                Width="120px" Visible="False">
                <DataItemTemplate>
                    <dx:ASPxCheckBox ID="CheckBox1" runat="server" ForeColor="#80A70E" 
                        Text="ยืนยันการส่งสินค้า">
                    </dx:ASPxCheckBox>
                </DataItemTemplate>
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsPager NumericButtonCount="14" PageSize="14">
        </SettingsPager>
        <Settings ShowFilterRow="True" />
        <SettingsDetail ShowDetailRow="True" />
        <Templates>
            <DetailRow>
                <dx:ASPxGridView ID="GV_OrderList" runat="server" AutoGenerateColumns="False" 
                    DataSourceID="SqlData_Orderlist" 
                     Width="100%"
                     onbeforeperformdataselect="detailGrid_DataSelect" 
                    oncustomunboundcolumndata="GV_OrderList_CustomUnboundColumnData">
                    <TotalSummary>
                        <dx:ASPxSummaryItem DisplayFormat="ราคารวม {0:#,###.00}" FieldName="Total" 
                            SummaryType="Sum" />
                    </TotalSummary>
                    <Columns>
                        <dx:GridViewDataDateColumn Caption="เลขที่ใบรายการ" FieldName="Order_Date" 
                            Visible="False" VisibleIndex="0">
                        </dx:GridViewDataDateColumn>
                        <dx:GridViewDataComboBoxColumn Caption="รายการสินค้า" FieldName="Product_ID" 
                            VisibleIndex="1">
                            <PropertiesComboBox DataSourceID="SqlData_Product" TextField="Product_name" 
                                ValueField="Product_ID">
                            </PropertiesComboBox>
                        </dx:GridViewDataComboBoxColumn>
                        <dx:GridViewDataTextColumn Caption="จำนวน" FieldName="Product_Count" 
                            VisibleIndex="2">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="ราคา" FieldName="Price" VisibleIndex="3">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="ส่วนลด" FieldName="Discount" 
                            VisibleIndex="4">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="ราคาสุทธิ" FieldName="Total" 
                            UnboundType="Integer" VisibleIndex="5">
                            <PropertiesTextEdit DisplayFormatString="c">
                            </PropertiesTextEdit>
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <SettingsPager Mode="ShowAllRecords">
                    </SettingsPager>
                    <Settings ShowFooter="True" />
                </dx:ASPxGridView>
                <asp:SqlDataSource ID="SqlData_Orderlist" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
                    SelectCommand="SELECT Order_Date, Product_ID, Product_Count, Price, Discount FROM TB_Orderlist WHERE (Order_Date = @Order_Date)">
                    <SelectParameters>
                        <asp:SessionParameter Name="Order_Date" SessionField="Order_Date" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </DetailRow>
        </Templates>
    </dx:ASPxGridView>
    <div align="center">
                    <dx:ASPxButton ID="bt_Cancle" runat="server" Text="ยกเลิก" 
                        OnClick="bt_Cancle_Click">
                    </dx:ASPxButton>
                </div>
    <asp:SqlDataSource ID="SqlData_Sender" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        
        SelectCommand="SELECT Order_Date, Customer_ID, Shipped_date, Delivery_Address, Status, Employee_ID, Status_Unpaid FROM TB_Order WHERE (Order_Date = @Order_Date)">
        <SelectParameters>
            <asp:SessionParameter Name="Order_Date" SessionField="Order_Date" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlData_Unpaid" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT * FROM [TB_StatusUnpaid]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlData_Product" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT [Product_name], [Product_ID] FROM [TB_Product]">
    </asp:SqlDataSource>
            </dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
    
</asp:Content>
